<?php
/**
 * [PHPFOX_HEADER]
 */

defined('PHPFOX') or exit('NO DICE!');

/**
 * 
 * 
 * @copyright		[PHPFOX_COPYRIGHT]
 * @author  		Raymond Benc
 * @package  		Module_Blog
 * @version 		$Id: ajax.class.php 3642 2011-12-02 10:01:15Z Miguel_Espinoza $
 */
class Hoidap_Component_Ajax_Ajax extends Phpfox_Ajax
{	
	public function addViaStatusUpdate()
	{
		// $this->call("alert(' addViaStatusUpdate ');");
	
		Phpfox::isUser(true);
		// Phpfox::getUserParam('hoidap.add_new_hoidap', true);
		
		$aVals = $this->get('val');
		$aVals['title'] = $aVals['title'];
		$aVals['text'] = $aVals['status_info'];
		$aVals['category_id'] = $aVals['category_id'];
		
		if (Phpfox::getLib('parse.format')->isEmpty($aVals['text']))
		{
			$this->call('$Core.resetActivityFeedError(\''.Phpfox::getPhrase('blog.please_provide_some_text_for_your_blog').'\');');
		}
		else
		{
			if (($iBlogId = Phpfox::getService('hoidap.process')->add($aVals)))
			{
				$iId = Phpfox::getService('feed.process')->getLastId();
				// $this->call("'.$iId.'");
// $oAjax = Phpfox::getLib('ajax');
						// $oAjax->alert("'.$iId.'");
				Phpfox::getService('feed')->processAjax($iId);
			}
		}
	}
	
	public function listcategorychild()
	{
		$oAjax = Phpfox::getLib('ajax');
		$catid =  $this->get('childcatid');
		$listcat = Phpfox::getService('hoidap.category')->selectListCategoryById($catid);
		
		Phpfox::getLib('template')->assign(array('listcat' => $listcat))->getTemplate('hoidap.block.cat_select');	
		$sNewContent =  $oAjax->getContent(false) ;
		$oAjax->html('#chide_category_id', $sNewContent);	
	}

}

?>